/******************************************************************************/
/*! 
    NAttributed
    [2012]

    \NAttributed.h
    \Core    
    \brief      
*/
/******************************************************************************/
/*** Include guard ************************************************************/
#ifndef ATTRIBUTED_H
#define ATTRIBUTED_H
/*** Includes *****************************************************************/
#include "NScope.h"
/*** Forward Declarations *****************************************************/
/*** Namespace ****************************************************************/
namespace Core
{
/*** Macros *******************************************************************/
/*** Constants ****************************************************************/
/*** Interface ****************************************************************/
class NAttributed : public NScope
{
	RTTI_DECLARATIONS(NAttributed, NScope)	

protected:
	struct Signature;

private:
	typedef std::vector<Signature> Signatures;

public:
	NAttributed(void);

	NAttributed(const NAttributed & rhs);

	virtual ~NAttributed();

	NAttributed& operator= (const NAttributed & rhs);

	virtual void Populate();
	
	bool IsPrescribedAttribute(const char* attributeName) const;
	
	bool IsAuxilliaryAttribute(const char* auxilliaryName) const;
	
	bool isAttribute(const char* attributeName) const;
	
	NDatum& AppendAuxiliaryAttribute(const char* attributeName);
	
	unsigned int AuxBegin() const;
	
	void Clear();

	Signatures* GetSignatures(){return &mSignatures;}

protected:
	Signatures mSignatures; //!<< Array of prescribed attributes
	
	struct Signature
	{
		Signature()
			:Name(""),
			 Type(NDatum::eType::eTYPE_POINTER),
			 InitValue(NULL),
			 NumberElements(0),
			 Storage(NULL)
		{
		}

		Signature(const char* name, NDatum::eType type, void* initValue, unsigned int numElements, void* storage)
			:Name(name),
			 Type(type),
			 InitValue(initValue),
			 NumberElements(numElements),
			 Storage(storage)
		{
		}

		const char*	    Name;			 //!<< Name of name-value pair for datuam
		NDatum::eType	Type;			 //!<< Type of uData stored in datum
		void*			InitValue;		 //!<< Value to init all entrys in datum to  
		void*			Storage;		 //!<< Memory address of external storage
		unsigned int	NumberElements;	 //!<< Number of entrys in the datum
	};
};
}
#endif
